package com.campus.counseling.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.campus.counseling.model.dto.AppointmentDTO;
import com.campus.counseling.model.dto.AppointmentQuery;
import com.campus.counseling.model.vo.AppointmentVO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.campus.counseling.entity.Appointment;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

public interface AppointmentService extends IService<Appointment> {
    /**
     * 创建预约
     */
    void createAppointment(AppointmentDTO dto);

    /**
     * 获取预约列表
     */
    Page<AppointmentVO> getAppointmentList(AppointmentQuery query);

    /**
     * 更新预约
     */
    void updateAppointment(AppointmentDTO dto);

    /**
     * 确认预约
     */
    void confirmAppointment(Long id);

    /**
     * 取消预约
     */
    void cancelAppointment(Long appointmentId, String reason);

    /**
     * 获取预约详情
     */
    AppointmentVO getAppointmentDetail(Long id);

    /**
     * 撤回取消的预约
     */
    void revokeAppointment(Long id);

    /**
     * 获取指定日期范围内的预约记录
     * @param counselorId 咨询师ID（可选）
     * @param startDate 开始日期
     * @param endDate 结束日期
     * @return 预约记录列表
     */
    List<Appointment> getAppointmentsByDateRange(Long counselorId, LocalDate startDate, LocalDate endDate);

    /**
     * 获取可预约的时间段列表
     * @param counselorId 咨询师ID
     * @param date 日期
     * @return 时间段列表，包含每个时间段的状态信息
     */
    List<Map<String, Object>> getAvailableTimeSlots(Long counselorId, LocalDate date);

    List<Appointment> getUpcomingAppointments(LocalDateTime start, LocalDateTime end);

    // 获取待确认的预约
    List<Appointment> getPendingAppointments(Long counselorId);

    List<Integer> getWeeklyAppointments();
    List<Map<String, Object>> getConsultationTypeStats();
    
    /**
     * 获取预约趋势统计
     * @param days 统计天数
     * @return 包含日期和预约数量的统计数据
     */
    Map<String, Object> getAppointmentTrend(Integer days);
} 